<?php
require $_SERVER['DOCUMENT_ROOT'].'/../_core/common.php';

//权限验证
if( Role::init() == false ){
	exit('没有权限');
}

require $_SERVER['DOCUMENT_ROOT'].'/../_interface/pages.php';

$db = new DB();

//状态数组
$status_arr = array(1=>'成功登录',2=>'登录失败',3=>'成功退出');

$page = isset($_GET['page']) ? intval($_GET['page']) : 1;//当前页码
$pageSize = 20;//每页条数

//查询总记录数
$total_sql = 'select id from logs_login';
$total = $db->query($total_sql)->getCount();

//分页html
$page_html = Pages::page($page, $total, $pageSize, '/admin/log/login_record.php');

//查询当前页记录
$login_record_sql = 'select username,status,ip,created from logs_login order by created desc limit '.(($page-1)*$pageSize).','.$pageSize;
$login_record_rs = $db->query($login_record_sql)->getAll();

require template('admin/log/login_record');